<template>
<div class="sign" style="margin: auto 0">
  <div>
  <el-table
      :data="tableData"
      style="width: 100%;"
      :row-class-name="tableRowClassName">
    <el-table-column
        prop="userName"
        label="打卡用户"
        width="200">
    </el-table-column>
    <el-table-column
        prop="signInTime"
        label="打卡时间"
        width="300">
    </el-table-column>
    <el-table-column
        prop="signInTemperature"
        label="体温"
        width="150">
    </el-table-column>
    <el-table-column
        prop="signInHealth"
        label="身体状况"
        width="250">
    </el-table-column>
    <el-table-column
        prop="signInAddress"
        label="打卡地点"
        width="300">
    </el-table-column>

  </el-table>
  </div>
</div>
</template>

<script>

import {getSignInfo} from "@/api/admin_api";

export default {
  name: "sigin_in_list",
  data(){
    return{
      tableData: [{
        signInTime: '2016-05-02',
        userName: '王理',
        signInTemperature: '36.2',
        signInHealth: '正常',
        signInAddress: '一栋1518',
        userId:''
      }, {
        signInTime: '2016-05-02',
        userName: '李海品',
        signInTemperature: '36.1',
        signInHealth: '正常',
        signInAddress: '一栋1321',
        userId:''
      }, {
        signInTime: '2016-05-02',
        userName: '王杰',
        signInTemperature: '37.2',
        signInHealth: '微热',
        signInAddress: '一栋1218',
        userId:''
      }, {
        signInTime: '2016-05-02',
        userName: '张芳华',
        signInTemperature: '38.1',
        signInHealth: '发热',
        signInAddress: '二栋1118',
        userId:''
      }]
    }
  },
  methods: {
    tableRowClassName({row, rowIndex}) {
      if (this.tableData[rowIndex].signInTemperature >= 37 && this.tableData[rowIndex].signInTemperature<38) {
        return 'warning-row';
      }else if (this.tableData[rowIndex].signInTemperature<37) {
        return 'success-row';
      }else {
        return 'danger-row';
      }
      return '';
    },

  },
  created() {
    // getSignInfo(0,1,10).then((res)=>{
    //   this.tableData = res.data.data;
    // })
  }
}
</script>

<style>
.sign .el-table .warning-row {
  background: #d4bba8;
}

.sign .el-table .success-row {
  background: #a8e2b0;
}

.sign .el-table .danger-row {
  background: #d4898d;
}

.sign .el-table .cell{
  text-align: center;
}

.sign .el-table {
  font-size: 17px;
  color: #606266;
}
</style>
